package com.budong.utils;

import com.alibaba.fastjson.JSON;

import java.util.Arrays;
import java.util.List;

import static com.budong.common.GifConstant.SUPPORT_URL;

/**
 * Created by jianweilin on 2017/1/14.
 */
public class StringUtils {

    public static Boolean isSupport(String url) {
        for (String str : SUPPORT_URL) {
            Integer index = url.indexOf(str);
            if (index != -1) {
                return true;
            }
        }
        return false;
    }

    public static boolean isMP4URL(List<String> urls) {
        System.out.println("urls => " + JSON.toJSONString(urls));
        boolean isMp4 = false;
        for (String url : urls) {
            if (url.indexOf("mp4") != -1) {
                isMp4 = true;
                break;
            }
        }
        return isMp4;
    }

    public static boolean isTimeFormat(List<String> times){
        System.out.println("times => " + JSON.toJSONString(times));
        boolean isFormat = true;
        for(String time : times){
            if(time.split(":").length != 3){
                isFormat = false;
                break;
            }
        }
        return isFormat;
    }

    public static void main(String[] args) {
        System.out.println("00:00:00".split(":").length);
        System.out.println(isTimeFormat(Arrays.asList("00:00:00")));
    }

}
